using System;

namespace Jztech.Collector.Common.Extension
{
    /// <summary>
    /// Exception扩展方法
    /// </summary>
    public static class ExceptionExtension
    {
        /// <summary>
        /// 获取内部异常
        /// </summary>
        /// <param name="exception"></param>
        /// <returns></returns>
        public static Exception GetInnerException(this Exception exception)
        {
            var ex = exception;
            while (ex.InnerException != null)
            {
                ex = ex.InnerException;
            }
            return ex;
        }

    }
}
